package main

import (
	"bufio"
	"fmt"
	"net"
	"os"
	"strings"
)

func main() {
	con, err := net.Dial("tcp", "localhost:8000")
	if err != nil {
		fmt.Println("Error dialing ", err)
	}
	defer con.Close()
	inputRead := bufio.NewReader(os.Stdin)
	for{
		input, _ := inputRead.ReadString('\n')
		content := strings.Trim(input,"\r\n" )
		if content == "Q" {
			return
		}
		_, err := con.Write([]byte(content))
		if err !=nil {
			fmt.Println("发送出错", err)
			return
		}
	}
}
